/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mavenrentcars.form;

import com.mavenrentcars.model.Car;
import com.mavenrentcars.model.Place;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 *
 * @author serg
 */
public class CarForm extends GenericForm {

    public String id = "";
    public String model = "";
    public String output_year = "";
    public String insurance = "";
    public String price = "";
    public String start_place = "";
    public String user = "";
    public Map<String, String> places = new HashMap<String, String>();

    public CarForm() {
    }

    public CarForm(Car item) {
        id = Integer.toString(item.getId());
        model = item.getModel();
        output_year = Integer.toString(item.getOutputYear());
        insurance = item.getInsurance();
        price = item.getPrice().toString();
        start_place = item.getStartPlace().getPlaceName();

        Set<Place> list = item.getPlaces();
        for (Place place : list) {
            places.put(Integer.toString(place.getId()), place.getPlaceName());
        }
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getOutputYear() {
        return output_year;
    }

    public void setOutputYear(String output_year) {
        this.output_year = output_year;
    }

    public String getInsurance() {
        return insurance;
    }

    public void setInsurance(String insurance) {
        this.insurance = insurance;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getStartPlace() {
        return start_place;
    }

    public void setStartPlace(String start_place) {
        this.start_place = start_place;
    }

    /*
     * 
     */
    public void setPlaces(Map<String, String> places) {
        this.places = places;
    }

    public Map<String, String> getPlaces() {
        return this.places;
    }
}
